package greedy;

import java.util.Arrays;

public class Solution455 {
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);

        int indexG = 0;
        int indexS = 0;

        while(indexG<g.length && indexS<s.length){
            if (g[indexG]>s[indexS]){
                indexS++;
            }else {
                indexG++;
                indexS++;
            }
        }

        return indexG;
    }


}
